<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8" />
    <title>统一地图平台</title><link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />

    <!-- 引入JSON数据展示样式 -->
    <link href="./js_example/script/script/utils/json/search.css" rel="stylesheet">
    <link href="./js_example/script/script/utils/json/prety-json.css" rel="stylesheet">

    <style>
        html,
        body,
        #mapui {
            width: 100%;
            height: 100%;
        }

        html,
        body {
            margin: 0;
            padding: 0;
        }
    </style>
</head>

<body>
    <div class="card-panel card-panel-top-right">
        <div class="card-json-info">
            <div class="input-item">
                <div class="input-item-prepend">
                    <span class="input-item-text" style="width:50px;">经纬度</span>
                </div>
                <input id='keyword-input' type="text" autocomplete="off" style="width: 120px;" value="110.349954,19.986691">
                <button onclick="querySearchResult()" class="demo-btn"
                    style="height: 30px;border-bottom-left-radius: 0;border-top-left-radius: 0;">查询
                </button>
            </div>
            <div class="info"><span id="result-info"></span></div>
        </div>
    </div>
    <div id="mapui"></div>

    <script src="./js_example/script/map.min.js"></script>
    <script src="./js_example/script/demo.js"></script>

    <!-- 引入JSON数据展示插件 -->
    <script src="./js_example/script/script/utils/json/jquery.min.js"></script>
    <script src="./js_example/script/script/utils/json/underscore.min.js"></script>
    <script src="./js_example/script/script/utils/json/backbone.min.js"></script>
    <script src="./js_example/script/script/utils/json/prety-json.js"></script>

    <script>
        

        var amap = null;
        map.Factory.create('mapui', {
            style: style,
            center: center,
            zoom: zoom,
            strategy: ['mapboxgl', 'openlayers', 'leaflet'],
            fullExtent: {
                xmin: 108.23365,
                ymin: 17.95253,
                xmax: 111.78395,
                ymax: 20.13104
            }
        }, (o) => {
            amap = o;
            querySearchResult();
        });

        function querySearchResult() {
            var location = document.getElementById("keyword-input").value;
            map.Factory.GeocodeData(function (geocodeData) {
                geocodeData.adminByPoint('mine', {
                    location: location
                }, function (res) {
                    new PrettyJSON.view.Node({
                        el: document.querySelector("#result-info"),
                        data: res
                    });
                });
            });
        }

    </script>
</body>

</html>